﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Office.OneNote
{
    public abstract class OneNoteObjectWithIdentity : OneNoteObject
    {
        internal static readonly OneNoteProperty LastModifiedTimeProperty = OneNoteProperty.Register(
            "lastModifiedTime", typeof(DateTime), typeof(OneNoteObjectWithIdentity));

        private OneNoteObjectId _ident;

        internal OneNoteObjectWithIdentity(OneNoteObjectId id)
        {
            _ident = id;
        }

        public OneNoteObjectId ObjectId
        {
            get
            {
                CheckValid();
                return _ident;
            }
        }

        public DateTime LastModifiedTime
        {
            get { return GetValue<DateTime>(LastModifiedTimeProperty); }
        }

        internal override void MarkInvalidOverride()
        {
            base.MarkInvalidOverride();
            _ident = OneNoteObjectId.Empty;
        }
    }
}
